<?php include './application/views/top.php'; ?>
<script src="/static/js/ajaxfileupload.js"></script>
<script src="/static/js/gsdai.js"></script>
<script src="/static/js/My97DatePicker/WdatePicker.js"></script>
<script src="/static/js/formCheck.js"></script>
<div class="clear"></div>
<div class="user_bottom all"></div>
<div class="clear h50"></div>
<div class="layout uc">
	<?php include './application/views/user/left.php'; ?>
	<?php
		$sex = $v['sex'];
		$cardType = $v['cardType'];
	?>
	<div class="right">
		<div class="menu_list"><?php include './application/views/user/menu.php'; ?></div>
        <div class="clear h30"></div>
        <div class="tishi" style="font-size:14px; font-weight:normal;">银行账号一经填写不得修改</div>
        <div class="cont">
			<form id="myform">
			<input type="hidden" name="act" value="submit">
        	<dl class="line">
            	<dt>真实姓名：</dt>
                <dd><?php echo strdisplay($user['realname'], 1); ?></dd>
            </dl>
        	<dl class="line">
            	<dt>账号：</dt>
                <dd><?php echo strdisplay($user['email'], 7); ?></dd>
            </dl>
            <?php if(isset($bank['user_id'])) {?>
        	<dl class="line">
            	<dt>开户银行：</dt>
                <dd><?php echo $bank_list[$bank['bank']]; ?></dd>
            </dl>
        	<dl class="line">
            	<dt>开户支行名称：</dt>
                <dd>
				<?php echo $bank['province'] ? $area[$bank['province']]:''; ?>
				<?php echo $bank['city'] ? $area[$bank['city']]:''; ?>
				<?php echo $bank['branch']; ?>
                </dd>
            </dl>
        	<dl class="line">
            	<dt>银行账号：</dt>
                <dd><?php echo strdisplay($bank['account'],4); ?></dd>
            </dl>
            <?php } else {?>
        	<dl class="line">
            	<dt>开户银行：</dt>
                <dd>
				<select name="bank">
				<?php foreach($bank_list as $k => $v){ ?>
					<option value="<?php echo $k; ?>"><?php echo $v; ?></option>
				<?php } ?>
				</select>
                </dd>
            </dl>
        	<dl class="line">
            	<dt>开户行所在地：</dt>
                <dd>
				<select name="province" id="province" onchange="changeCity(this.value,'city');"><option value="">请选择</option></select>
				<select name="city" id="city" onchange="changeCity(this.value,'area');"><option value="">请选择</option></select>
                </dd>
            </dl>
		<script>
		$(document).ready(function(){
			getArea(0,'','province');
		});
		function changeCity(a,obj){
			var msg = "<option value=''>请选择</option>";
			if(a!=''){
				getArea(a,'',obj);
				if(obj=='city'){
					$("#area").html(msg);
				}
			}else{
				if(obj=='city'){
					$("#city").html(msg);
					$("#area").html(msg);
				}
			}
			
		}
		function getArea(pid, selected, obj){
			$.ajax({
				type: "POST",
				url: "/area/get_option1",
				data: "pid="+pid+"&selected="+selected,
				success: function(msg){
					$("#"+obj).html(msg);
				},
				dataType: "text"
			});
		}
		</script>
        	<dl class="line">
            	<dt>开户支行：</dt>
                <dd><input class="input" type="text" name="branch"  value="" size="20" /></dd>
            </dl>
        	<dl class="line">
            	<dt>银行账号：</dt>
                <dd><input class="input" type="text" name="account"  value="" size="20" /></dd>
            </dl>
        	<dl class="line">
            	<dt>验证码：</dt>
                <dd>
                	<input class="fl" type="text" id="captcha" name="captcha" style="width:45px;" maxlength="4">
                    <div class="code"><img src="/yanzheng/index/" id="imgCode" onclick="changeImage();" style="cursor:pointer;border: 0;"/></div>
                </dd>
            </dl>
            <div class="cb"><input class="button" type="button" value="确认提交" onclick="toSubmit();" /></div>
            <?php } ?>
            </form>
        </div>
	</div>
</div>
<div class="clear h50"></div>
<?php include "./application/views/footer.php";?>
<div id="dialog2" title="系统提示" style="display:none;" >
<p id="msg2" style="text-align:center;clear: both;"></p>
</div>
<script>
function toSubmit(){
	$('#dialog').dialog({
		modal:true,
		title:'系统提示',
		buttons:{"确定":function(){
			var options = {
				url : '/account/bank',
				dataType: "text",
				type:"post",
				success : function(ret) {
					if(ret==''){
						msg='提交成功';
					}else{
						msg=ret;
					}
					$('#dialog2').dialog({
						modal:true,
						title:'系统提示',
						buttons:{"确定":function(){$('#dialog2').dialog("close");}},
						close: function() {
							if(ret==''){
								window.location='/account/bank.html';
							}else{
								document.getElementById("imgCode").src = "/yanzheng/index/?" + Math.random();
							}
						}
					}); 
					$("#msg2").html(msg);
				}
			};
			$("#myform").ajaxSubmit(options);
		},
		"取消":function(){$(this).dialog("close");}}
	}); 
	$("#msg").html("您现在填写的是提现账号，您从平台上的提现皆转入此账户，请仔细核对，账户名必须与您实名认证的名字一致，若因客户填写错误导致转账失败，本站不承担责任！");
	return false;
}
</script>
